package org.langke.design.pattern.strategy;

/**
 * 策略模式
 */
public abstract class PaymentStrategy {
    public abstract String getName();
    protected abstract double queryBalance(String uid);
    public PayResult pay(String uid,double amount){
        if (queryBalance(uid) < amount){
            return new PayResult(500,"支付失败","余额不足");
        }
        return new PayResult(200,"支付成功","支付余额："+(queryBalance(uid) - amount) + "元");
    }
}
